// Frame.h

/*
   Copyright 2006 Corey Tabaka

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/

#include <Component.h>
#include <Container.h>
#include <Common.h>

#ifndef __GUI_FRAME_H__
#define __GUI_FRAME_H__

namespace gui {

	class Frame : public Component {
		public:
		
		Frame(const char *title);
		virtual ~Frame(void);
		
		virtual RefContainer getContentPane(void);
		
		// from Component
		virtual void validate(void);
		virtual void invalidate(void);
		virtual void repaint(RefGraphics g);
		virtual void paint(RefGraphics g);
		
		virtual Dimension getPreferredSize(void);
		virtual Dimension getMinimumSize(void);
		
		virtual void setSize(int width, int height);
		
		static void prepend(RefFrame frame);
		static void append(RefFrame frame);
		static void remove(RefFrame frame);
		
		static void repaintVisible(RefGraphics g, Rectangle *region=0);
		static RefFrame hitTest(int x, int y);
		
		void toFront(void);
		void toBack(void);
		
		private:
		
		char *title;
		
		Container content;
		
		// priority queue for use by window manager
		int priority;
		RefFrame next, prev;
		
		static RefFrame head, tail;
	};

} // namespace gui

#endif
